package com.tencent.stat.common;

import android.util.Log;
import com.tencent.stat.StatConfig;
import com.tencent.stat.StatCustomLogger;

public final class StatLogger
{
  private String a = "default";
  private boolean b = true;
  private int c = 2;

  public StatLogger()
  {
  }

  public StatLogger(String paramString)
  {
    this.a = paramString;
  }

  private String a()
  {
    StackTraceElement[] arrayOfStackTraceElement = Thread.currentThread().getStackTrace();
    if (arrayOfStackTraceElement == null)
      return null;
    int j = arrayOfStackTraceElement.length;
    int i = 0;
    while (true)
    {
      if (i < j);
      StackTraceElement localStackTraceElement = arrayOfStackTraceElement[i];
      if ((!(localStackTraceElement.isNativeMethod())) && (!(localStackTraceElement.getClassName().equals(Thread.class.getName()))) && (!(localStackTraceElement.getClassName().equals(super.getClass().getName()))))
        return "[" + Thread.currentThread().getName() + "(" + Thread.currentThread().getId() + "): " + localStackTraceElement.getFileName() + ":" + localStackTraceElement.getLineNumber() + "]";
      i += 1;
    }
  }

  public final void d(Object paramObject)
  {
    if (!(isDebugEnable()))
      return;
    debug(paramObject);
  }

  public final void debug(Object paramObject)
  {
    Object localObject;
    if (this.c <= 3)
    {
      localObject = a();
      if (localObject != null)
        break label47;
    }
    for (paramObject = paramObject.toString(); ; paramObject = ((String)localObject) + " - " + paramObject)
    {
      Log.d(this.a, paramObject);
      localObject = StatConfig.getCustomLogger();
      if (localObject != null)
        ((StatCustomLogger)localObject).debug(paramObject);
      label47: return;
    }
  }

  public final void e(Object paramObject)
  {
    if (!(isDebugEnable()))
      return;
    error(paramObject);
  }

  public final void e(Throwable paramThrowable)
  {
    if (!(isDebugEnable()))
      return;
    error(paramThrowable);
  }

  public final void error(Object paramObject)
  {
    Object localObject;
    if (this.c <= 6)
    {
      localObject = a();
      if (localObject != null)
        break label48;
    }
    for (paramObject = paramObject.toString(); ; paramObject = ((String)localObject) + " - " + paramObject)
    {
      Log.e(this.a, paramObject);
      localObject = StatConfig.getCustomLogger();
      if (localObject != null)
        ((StatCustomLogger)localObject).error(paramObject);
      label48: return;
    }
  }

  public final void error(Throwable paramThrowable)
  {
    if (this.c > 6)
      return;
    Log.e(this.a, "", paramThrowable);
    StatCustomLogger localStatCustomLogger = StatConfig.getCustomLogger();
    if (localStatCustomLogger == null)
      return;
    localStatCustomLogger.error(paramThrowable);
  }

  public final int getLogLevel()
  {
    return this.c;
  }

  public final void i(Object paramObject)
  {
    if (!(isDebugEnable()))
      return;
    info(paramObject);
  }

  public final void info(Object paramObject)
  {
    Object localObject;
    if (this.c <= 4)
    {
      localObject = a();
      if (localObject != null)
        break label47;
    }
    for (paramObject = paramObject.toString(); ; paramObject = ((String)localObject) + " - " + paramObject)
    {
      Log.i(this.a, paramObject);
      localObject = StatConfig.getCustomLogger();
      if (localObject != null)
        ((StatCustomLogger)localObject).info(paramObject);
      label47: return;
    }
  }

  public final boolean isDebugEnable()
  {
    return this.b;
  }

  public final void setDebugEnable(boolean paramBoolean)
  {
    this.b = paramBoolean;
  }

  public final void setLogLevel(int paramInt)
  {
    this.c = paramInt;
  }

  public final void setTag(String paramString)
  {
    this.a = paramString;
  }

  public final void v(Object paramObject)
  {
    if (!(isDebugEnable()))
      return;
    verbose(paramObject);
  }

  public final void verbose(Object paramObject)
  {
    Object localObject;
    if (this.c <= 2)
    {
      localObject = a();
      if (localObject != null)
        break label47;
    }
    for (paramObject = paramObject.toString(); ; paramObject = ((String)localObject) + " - " + paramObject)
    {
      Log.v(this.a, paramObject);
      localObject = StatConfig.getCustomLogger();
      if (localObject != null)
        ((StatCustomLogger)localObject).verbose(paramObject);
      label47: return;
    }
  }

  public final void w(Object paramObject)
  {
    if (!(isDebugEnable()))
      return;
    warn(paramObject);
  }

  public final void warn(Object paramObject)
  {
    Object localObject;
    if (this.c <= 5)
    {
      localObject = a();
      if (localObject != null)
        break label47;
    }
    for (paramObject = paramObject.toString(); ; paramObject = ((String)localObject) + " - " + paramObject)
    {
      Log.w(this.a, paramObject);
      localObject = StatConfig.getCustomLogger();
      if (localObject != null)
        ((StatCustomLogger)localObject).warn(paramObject);
      label47: return;
    }
  }
}